import React from 'react'
import './chatRoom.css'

//组件
import ChatHeader from 'components/Chat/ChatHeader'
import ChatNav from 'components/Chat/ChatNav'
import ChatContainer from 'components/Chat/ChatContainer'
import ChatFooter from 'components/Chat/ChatFooter'

class ChatRobot extends React.Component{
constructor(props){
    super(props)
    this.state={
        robotName:'xiuer',
        content:[
            {
                content:"你好啊我是吉大秀儿",
                type:"robot"
            }]
    }
    }
    submit(e) {
        var item=this.state.content
        item.push({
            content:e,
            type:'user'
        })
        this.setState({
            content:item
        })
        console.log(this.state.content)
    }
  render(){
      return(
          <div className="chatroom">
              <ChatNav></ChatNav>
              <div className='chatcontainer'>
                  <ChatHeader name={this.state.robotName}></ChatHeader>
                  <ChatContainer chatcontent={this.state.content}></ChatContainer>
                  <ChatFooter chatSubmit={(e)=>{this.submit(e)}}></ChatFooter>
              </div>
          </div>
  )
  }
}

export default ChatRobot